/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mobiwebinc.compconn.factory;

import com.mobiwebinc.compconn.client.Authenticator;
import com.mobiwebinc.compconn.client.ConfigGrabber;

import com.mobiwebinc.compconn.client.processor.ClientProcessor;
import com.mobiwebinc.compconn.client.processor.ClientProcessorWriteOnly;
import com.mobiwebinc.compconn.client.processor.Processor;

/**
 *
 * @author suraj
 */
public class ClientProcessorFactory {

    private static ClientProcessorFactory clientProcessorFactory;

    private ClientProcessorFactory() {
    }

    public static ClientProcessorFactory getInstance() {
        if (clientProcessorFactory == null) {
            clientProcessorFactory = new ClientProcessorFactory();
        }
        return clientProcessorFactory;
    }

    public Processor getProcessor(ConfigGrabber grabber, Authenticator authenticator) {
        Processor processor = null;
        if (authenticator.isWriteOnly()) {
            processor = new ClientProcessorWriteOnly(grabber);
        } else {
            processor = new ClientProcessor(grabber);
        }
        return processor;
    }
}
